<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="./template.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .ui-treetable {
                margin-top: 40px
            }
            .ui-treetable table {
                table-layout: fixed
            }
            
            body .ui-button {
                margin: 10px 0 0 0;
            }
        </style>
    </ui:define>
    
    <ui:define name="title">
        TreeTable - <span class="subitem">Selection</span>
    </ui:define>

    <ui:define name="description">
        Tree provides three selection modes, "single", "multiple" and "checkbox" in addition to the regular column based selection.
    </ui:define>

    <ui:param name="documentationLink" value="/components/treetable" />

    <ui:define name="implementation">
        
        <h:form>
            <p:growl id="msgs" showDetail="true" escape="false"/>
            
            <p:treeTable value="#{ttSelectionView.root1}" var="document" selectionMode="single" selection="#{ttSelectionView.selectedNode}" style="margin-top:0">
                <f:facet name="header">
                    Single
                </f:facet>
                <p:column headerText="Name">
                    <h:outputText value="#{document.name}" />
                </p:column>
                <p:column headerText="Size">
                    <h:outputText value="#{document.size}" />
                </p:column>
                <p:column headerText="Type">
                    <h:outputText value="#{document.type}" />
                </p:column>
            </p:treeTable>
            
            <p:commandButton value="Display" update="msgs" icon="pi pi-clone"
								action="#{ttSelectionView.displaySelectedSingle}"/>
            
            <p:treeTable value="#{ttSelectionView.root2}" var="document" selectionMode="multiple" selection="#{ttSelectionView.selectedNodes1}">
                <f:facet name="header">
                    Multiple with metakey
                </f:facet>
                <p:column headerText="Name">
                    <h:outputText value="#{document.name}" />
                </p:column>
                <p:column headerText="Size">
                    <h:outputText value="#{document.size}" />
                </p:column>
                <p:column headerText="Type">
                    <h:outputText value="#{document.type}" />
                </p:column>
            </p:treeTable>
            
            <p:commandButton value="Display" update="msgs" icon="pi pi-clone"
                             action="#{ttSelectionView.displaySelectedMultiple(ttSelectionView.selectedNodes1)}"/>
            
            <p:treeTable value="#{ttSelectionView.root3}" var="document" selectionMode="checkbox" selection="#{ttSelectionView.selectedNodes2}">
                <f:facet name="header">
                    Checkbox
                </f:facet>
                <p:column headerText="Name">
                    <h:outputText value="#{document.name}" />
                </p:column>
                <p:column headerText="Size">
                    <h:outputText value="#{document.size}" />
                </p:column>
                <p:column headerText="Type">
                    <h:outputText value="#{document.type}" />
                </p:column>
            </p:treeTable>
            
            <p:commandButton value="Display" update="msgs" icon="pi pi-clone"
								action="#{ttSelectionView.displaySelectedMultiple(ttSelectionView.selectedNodes2)}"/>
        </h:form>
        
    </ui:define>

</ui:composition>